home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / npp / np.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.6 KB  |  114 lines

  1. // np.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "np.h"
  6. #include "mainfrm.h"
  7. #include "npdoc.h"
  8. #include "npview.h"
  9.  
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char BASED_CODE THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CNotepadApp
  17.  
  18. BEGIN_MESSAGE_MAP(CNotepadApp, CWinApp)
  19.     //{{AFX_MSG_MAP(CNotepadApp)
  20.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  21.     //}}AFX_MSG_MAP
  22.     // Standard file based document commands
  23.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  24.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  25. END_MESSAGE_MAP()
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // The one and only CNotepadApp object
  29.  
  30. CNotepadApp theApp;
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CNotepadApp initialization
  34.  
  35. BOOL CNotepadApp::InitInstance()
  36. {
  37.     // Register document templates
  38.  
  39.     CSingleDocTemplate* pDocTemplate;
  40.     pDocTemplate = new CSingleDocTemplate(
  41.         IDR_MAINFRAME,
  42.         RUNTIME_CLASS(CNotepadDoc),
  43.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  44.         RUNTIME_CLASS(CNotepadView));
  45.     AddDocTemplate(pDocTemplate);
  46.  
  47.     OnFileNew();
  48.  
  49.     return TRUE;
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CAboutDlg dialog used for App About
  54.  
  55. class CAboutDlg : public CDialog
  56. {
  57. public:
  58.     CAboutDlg();
  59.  
  60. // Dialog Data
  61.     //{{AFX_DATA(CAboutDlg)
  62.     enum { IDD = IDD_ABOUTBOX };
  63.     //}}AFX_DATA
  64.  
  65. // Implementation
  66. protected:
  67.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  68.     //{{AFX_MSG(CAboutDlg)
  69.     virtual BOOL OnInitDialog();
  70.     //}}AFX_MSG
  71.     DECLARE_MESSAGE_MAP()
  72. };
  73.  
  74. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  75. {
  76.     //{{AFX_DATA_INIT(CAboutDlg)
  77.     //}}AFX_DATA_INIT
  78. }
  79.  
  80. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  81. {
  82.     CDialog::DoDataExchange(pDX);
  83.     //{{AFX_DATA_MAP(CAboutDlg)
  84.     //}}AFX_DATA_MAP
  85. }
  86.  
  87. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  88.     //{{AFX_MSG_MAP(CAboutDlg)
  89.         // No message handlers
  90.     //}}AFX_MSG_MAP
  91. END_MESSAGE_MAP()
  92.  
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CAboutDlg message handlers
  95.  
  96. BOOL CAboutDlg::OnInitDialog() 
  97. {
  98.     CDialog::OnInitDialog();
  99.     CenterWindow();    
  100.     return TRUE;  // return TRUE unless you set the focus to a control
  101.                   // EXCEPTION: OCX Property Pages should return FALSE
  102. }
  103.  
  104. // App command to run the dialog
  105. void CNotepadApp::OnAppAbout()
  106. {
  107.     CAboutDlg aboutDlg;
  108.     aboutDlg.DoModal();
  109. }
  110.  
  111. /////////////////////////////////////////////////////////////////////////////
  112. // CNotepadApp commands
  113.  
  114.